package routers

import (
	"github.com/gin-gonic/gin"
	swaggerFiles "github.com/swaggo/files"
	gs "github.com/swaggo/gin-swagger"
	"giv-vue-blog/global"
)

type RouterGroup struct {
	*gin.RouterGroup
}

func InitRouter() *gin.Engine {
	gin.SetMode(global.Config.System.Env) //就没有运行开始的那一大坨加载项了
	router := gin.Default()
	//引入swagger
	router.GET("/swagger/*any", gs.WrapHandler(swaggerFiles.Handler))
	//路由分组
	apiRouterGroup := router.Group("api")
	routerGroup := RouterGroup{apiRouterGroup}
	//系统配置api
	routerGroup.SettingsRouter()
	routerGroup.ImagesRouter()
	routerGroup.AdvertRouter()
	routerGroup.MenuRouter()
	routerGroup.UserRouter()
	routerGroup.TagRouter()
	routerGroup.MessageRouter()
	routerGroup.ArticleRouter()
	routerGroup.DiggRouter()
	routerGroup.CommentRouter()
	routerGroup.NewsRouter()
	routerGroup.ChatRouter()
	routerGroup.LogRouter()
	routerGroup.DataLoginRouter()
	return router
}
